package cn.wolfcode.shop.controller;

import cn.wolfcode.shop.domain.PropertyValue;
import cn.wolfcode.shop.domain.SkuPropertyValue;
import cn.wolfcode.shop.service.IPropertyValuesService;
import cn.wolfcode.shop.service.ISkuPropertyValuesService;
import cn.wolfcode.shop.vo.JSONResult;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 商品分类属性值相关
 */
@Controller
@RequestMapping("skuPropertyValues")
public class SkuPropertyValuesController {
    @Reference
    private ISkuPropertyValuesService propertyValuesService;
    @DeleteMapping("{id}")
    @ResponseBody
    public JSONResult deleteById(@PathVariable("id") Long id){
        JSONResult jsonResult=new JSONResult();
        propertyValuesService.deleteById(id);
        return jsonResult;
    }

    @PostMapping
    @ResponseBody
    public JSONResult inputValues(@RequestBody List<SkuPropertyValue> propertyValueList){
        JSONResult jsonResult=new JSONResult();
        propertyValuesService.inputValues(propertyValueList);
        return jsonResult;
    }
}
